package com.training.food.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.training.food.Mapper.SlaughterMapper;
import com.training.food.pojo.Initialpur;
import com.training.food.pojo.Slaughter;
import com.training.food.service.SlaughterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SlaughterServiceImpl extends ServiceImpl<SlaughterMapper, Slaughter> implements SlaughterService {
    @Autowired
    SlaughterMapper slaughterMapper;
    @Override
    public Integer add(Slaughter slaughter) {
        return slaughterMapper.insert(slaughter);
    }

    @Override
    public void delete(Slaughter slaughter) {
        slaughterMapper.delete(slaughter);
    }

    @Override
    public boolean select(Slaughter slaughter) {
        Slaughter slaughter1=slaughterMapper.select(slaughter);
        if (slaughter1!=null)return true;
        return false;
    }

    @Override
    public void update(Slaughter slaughter) {
        slaughterMapper.update(slaughter);
    }

    @Override
    public List<Slaughter> slaughterInfos(List<Initialpur> initialpur) {

        return slaughterMapper.thelist(initialpur);
    }

    @Override
    public List<Slaughter> selectByUser(String username, String state) {
        return slaughterMapper.selectByUser(username,state);
    }

    @Override
    public List<Slaughter> selectAll(Slaughter slaughter) {
        return slaughterMapper.selectAll(slaughter.getState());
    }

    @Override
    public Slaughter selectById(int id) {
        return slaughterMapper.selectById(id);
    }


}
